<template>
	<view >
		<back-fixed title="医生专属码"></back-fixed>
		<view class="main" @click="wxDown">
			<u-image :src="qrUrl" height="1640"></u-image>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				cardId:'',
				qrUrl:'',
				urlBack:''
			}
		},
		onLoad(obj) {
			if (obj.cardId) {
				this.cardId = obj.cardId
				this.urlBack = `/pages/intel/details?cardId=${this.cardId}`
			}else{
				this.urlBack = '/pages/intel/details'
			}
			this.qrUrl = uni.getStorageSync('qrUrl')
		},
		methods: {
			wxDown() {
				var that = this;
				// 获取图片信息
				this.$ww.getImageInfo({
					src: this.qrUrl,
					success: function(res) {
						// 保存图片到系统相册
						//console.log(res,'res');
						this.$ww.saveImageToPhotosAlbum({
							filePath: res.path,
							success: function(res) {
								uni.showToast({
									title: '图片保存成功!!',
									icon: 'success',
									duration: 2000
								});
							},
							fail: function(err) {
								console.log(err);
								this.$ww.showToast({
									title: '图片保存失败!!',
									icon: 'none'
								});
							}
						});
					},
					fail: function(err) {
						//console.log(err);
						uni.showToast({
							title: '获取图片信息失败!!,请更新隐私政策',
							icon: 'none'
						});
					}
				});
			},
		},
	}
</script>

<style lang="scss" scoped>
.main{
	//padding-top: 180rpx;
	//background-color: #F8F8F8;
}
</style>